<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <script src="./throttle.js"></script>
    <!-- <script src="./lib/throttle.js"></script> -->
  </head>
  <body>
    <script>
      var i = 0;
      var startTime = Date.now();
      var repeat = function (fn) {
          var timerId = null;
          var startTime = 0;
          timerId = setInterval(function() {
              if (!startTime) {
                  startTime = Date.now()
              }
              if (Date.now() - startTime >= 1000) {
                  clearInterval(timerId)
              }
              fn();
          }, 0)
      }
      var echo = function(e) {
          console.log(++i, Date.now() - startTime)
      }     
      var echoThrottle = throttle(echo, 100)
      // repeat(echo)
      repeat(echoThrottle)
    </script>
  </body>
</html>
